#pragma once

#include "game_entity.h"
#include <vector>

class Character : public GameEntity
{
public:
    Character()
		:_bodyModel(0)
		,_bodySprite(nullptr)
		,_actionDirty(false)
		,_directionDirty(false)
		,_pathStep(1)
	{
	}
    virtual ~Character();
    static Character* create();
    virtual bool init();
    virtual void run(long tick);
    virtual void render(long tick);

    virtual void setDirection(DirectionType direction);
    virtual void setAction(ActionType action);
    virtual void setBodyModel(int model);

    int getBodyModel() { return _bodyModel; }

	virtual void movePath(std::vector<cocos2d::Point>& path);
	virtual void moveCancel();

protected:
    void playBodyAnimate();
	void createBodyAnimate();
	void onBodyCreated(cocos2d::Texture2D *texture);
	virtual void setMoveCrood(const cocos2d::Point &crood);
    
protected:
    int _bodyModel;
	cocos2d::Sprite *_bodySprite;

	cocos2d::Point _toCrood;
	std::vector<cocos2d::Point> _path;
	int _pathStep;

private:
    bool _actionDirty;
	bool _directionDirty;
};